<!DOCTYPE html>
<html>
	<head>
	    <meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
		<link rel="stylesheet" href="//at.alicdn.com/t/font_604979_156g2g4k47w7mn29.css" />
		<link rel="stylesheet" href="$!rc.contextPath/common/common.css" />
		<link rel="stylesheet" href="$!rc.contextPath/css/accounts.css" />
		<title>结算付款</title>
	</head>
	<body>
	<div class="title text-center">
		<a onClick="javascript:window.history.go(-1)"><</a>
		结算付款
	</div>
	<div class="site" onclick="javascript:window.location.href='$!rc.contextPath/memberView/addressChoose'">
		<div class="consignee">
			<div class="name">
				收货人：$!address.delivery_receiver
			</div>
			<div class="phone">
				$!address.delivery_mobile
			</div>
		</div>
		<div class="site-place">
			<i class="iconfont icon-dingwei1 location"></i>
			<div >
				<div class="site-detail">
					<span class="site-title">收货地址：</span>
					<p>$!address.delivery_address</p >
				</div>
			</div>
			<i class="iconfont icon-arrow-right-copy-copy-copy"></i>
		</div>
		<!-- <div class="site-place">
			<i class="iconfont icon-dingwei1 location"></i>
			<span>收货地址：$!address.delivery_address</span>
			<i class="iconfont icon-arrow-right-copy-copy-copy"></i>
		</div> -->
	</div>
	<div class="shops-title">
		参镜39度
	</div>
	#foreach($sku in $list)
	<div class="shops-detail" onclick="javascript:window.location.href='$!rc.contextPath/skuView/detail?skuId=$!sku.sku_id'">
		<img src="http://app.tmaipay.com/$!sku.attach_path" alt="" />
		<div class="shops-intro">
			<div class="shops-name">
				$!sku.sku_name
			</div>
			<div>
				<div class="price">
					<div class="yen">￥</div>
					<div class="price-num">
					$!sku.sku_price
					</div>
				</div>
				<div class="count" val="$!sku.sku_price" id="skuAmount">×$!sku.sku_amount</div>
				
			</div>
		</div>
	</div>
	#end
	<ul class="oder-list">
		<li class="order-item">
			<div class="item-left">
				配送方式
			</div>
			<div class="item-right choose-method">
				<span id="ps"></span>
			</div>
		</li>
		<li class="order-item" #if ($!score.usedScore == 0) style="display: none;" #end>
			<div class="item-left">
				抵扣积分
			</div>
			<div class="item-right choose-score">
				<span id="sc"></span>
			</div>
		</li>
		<li class="order-item">
			<div class="item-left">
				支付方式
			</div>
			<div class="item-right">
				<span>在线支付</span>
				<i class="iconfont icon-arrow-right-copy-copy-copy more"></i>
			</div>
		</li>
		<!-- <li class="order-item">
			<div class="item-left">
				优惠券
			</div>
			<div class="item-right coupon">
				0张拥有
			</div>
		</li> -->
		<li class="order-item remark">
			<div class="item-left">
				备注
			</div>
			<textarea class="remark-input" placeholder="您的留言备注"></textarea>
		</li>
	</ul>
	<div class="submit">
		<div class="submit-btn" onclick="f_pay();">
			立即支付
		</div>
		<div class="submit-left">
			<div>
				合计：
			</div>
			<div class="price">
				<div class="yen">￥</div>
				<div class="price-num" id="pm">$!payMoney</div>
			</div>
		</div>
	</div>
	<div class="confirm">
		<p class="confirm-title">请选择配送方式</p >
		<ul class="method">
			<li val="1">送货上门</li>
			<li val="2">到店自提</li>
		</ul>
	</div>
	<div class="score">
		<p class="score-title">请选择是否使用积分</p >
		<ul class="method">
			<li val="1">不使用</li>
			<li val="2">积分抵扣</li>
		</ul>
	</div>
	</body>
	<script src="$!rc.contextPath/common/jquery-1.8.3.min.js"></script>
	<script type="text/javascript">
	var addrId = 0;
	var integral = '$!score.integral';
	var usedScore = '$!score.usedScore';
	var integral = '$!score.integral';
	var usedScore = '$!score.usedScore';
	var dkMoney = '$!score.dkMoney';
	var scoreMoney = '$!score.scoreMoney';
	var payMoney = '$!payMoney';
	var jsMoney = '$!score.scoreMoney';
	
	/*选择*/
	$(".choose-method").on("click",function(){
		$(".confirm").show();
	})
	$(".confirm li").on("click",function(){
		if($(this).attr("val") == 2){
			addrId = 0;
			$("#ps").html("门店自提（" + sessionStorage.getItem('storeName') + "）")
		}else{
			addrId = '$!address.delivery_addr_id';
			$("#ps").html("送货上门（" + sessionStorage.getItem('storeName') + "）");
		}
		$(".confirm").hide();
	})
	
	$(".choose-score").on("click",function(){
		$(".score").show();
	})
	$(".score li").on("click",function(){
		if($(this).attr("val") == 1){
			usedScore = 0;
			$("#sc").html("不使用积分");
			$("#pm").html(payMoney);
			jsMoney = '$!money';
		}else{
			usedScore = '$!score.usedScore';
			$("#sc").html("可抵扣" + usedScore + "积分");
			$("#pm").html(scoreMoney + "(积分抵扣" + dkMoney + "元)");
			jsMoney = '$!score.scoreMoney';
		}
		$(".score").hide();
	})
	
	
	$(function(){
		
		if(sessionStorage.getItem('storeName') == null){
			alert("请先选择门店！");
			location.href = '$!rc.contextPath/storeView/list?areaId=' + sessionStorage.getItem('areaId');
		}
		
		$("#ps").html("送货上门（" + sessionStorage.getItem('storeName') + "）")
		$("#sc").html("可抵扣" + usedScore + "积分");
		
		if(usedScore > 0){
			$("#pm").html(scoreMoney + "  (积分抵扣" + dkMoney + "元)");
		}else{
			$("#pm").html(payMoney);
		}
		
		var addr = '$!address';
		if(!addr){
			alert("请先设置收货地址！");
			window.location.href = '$!rc.contextPath/memberView/addressChoose';
		}else{
			addrId = '$!address.delivery_addr_id';
		}
	})
	
	function f_pay(){
		
		var ids = '$!ids';
		var storeId = sessionStorage.getItem('storeId');
		
		window.location.href="$!rc.contextPath/WXJsPay?payMoney=" + jsMoney + "&ids=" + ids + "&storeId=" + storeId + "&addrId=" + addrId + "&orderPoint=" + usedScore;
	}
	</script>
</html>
